package org.yo.router.compiler.base;


import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.Messager;
import javax.annotation.processing.ProcessingEnvironment;
import javax.tools.Diagnostic;

/**
 * @author hailong
 * @date 2021年10月28日 4:04 下午
 * <p>
 * You never know what you can do until you try !
 * ----------------------------------------------------------------
 */
public abstract class BaseProcessor extends AbstractProcessor {

    protected Messager messager;

    @Override
    public synchronized void init(ProcessingEnvironment processingEnv) {
        super.init(processingEnv);
        messager = processingEnv.getMessager();
    }

    /**
     * 打印日志
     *
     * @param log 日志信息
     */
    public void log(String log) {
        if (messager != null) {
            messager.printMessage(Diagnostic.Kind.NOTE, log);
        }
    }


}
